<?php
include 'config.php';
$sqlcon=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
$sql_db=mysql_select_db($sugar_config['dbconfig']['db_name'],$sqlcon);
$result0 = "Select * from contacts where birthdate IS NOT NULL  AND deleted = 0  ORDER BY birthdate ";
$res0 = mysql_query($result0);
while ($row0 = mysql_fetch_array($res0))
{
    $bday = $row0['birthdate'];
   // echo $bday;
   $id=$row0['id'];
  	$bday= explode("-",$bday);
  	$bd_month=$bday[1];//month of original birthdate
	$bd_date=$bday[2];//date of original birthdate
	$date_birth=$bd_month."/".$bd_date;//merge date and month
		
		
	$dd=strtotime($date_birth);//convert string to time
		$n_Bday=date('Y-m-d',$dd);//assign SQL format
		mysql_query("UPDATE contacts_cstm SET birthday_search_c = '".$n_Bday."' WHERE id_c = '".$id."'");

}




?>
